<template name="mine">
	<view>
		<cu-custom bgColor="bg-blue"><block slot="content">猎阵生物</block></cu-custom>
		<view class="bg-blue mine-top" :style="[{top:CustomBar + 'px'}]">
			<view class="mine">
				<image :src="member.avatar"  class="cu-avatar lg margin-left-xl" style="background-image:url(https://ossweb-img.qq.com/images/lol/web201310/skin/big10001.jpg);"></image>
				<view class=" flex-sub margin-left-sm" @click="goAuth">
					<view class="text-white text-df">
						<text >{{member?member.nickName:"授权登陆"}}</text>
					</view>
					<view v-if="member&&member.phonenumber" class="text-white text-xs">
						{{member.phonenumber}}
					</view>
				</view>
			</view>
		</view>
		<view class="cu-list grid col-4 no-border">
			<view class="cu-item" v-if="roles.indexOf('submit')!=-1" @click="goMineOrderList">
				<view class="cuIcon-cardboardfill text-red">
					<!-- <view class="cu-tag badge">
						<block>3</block>
					</view> -->
				</view>
				<text>下单信息</text>
			</view>
			<view class="cu-item" v-if="roles.indexOf('common')!=-1" @click="goAcceptOrderList">
				<view class="cuIcon-noticefill text-olive">
				</view>
				<text>订单受理</text>
			</view>
			<view class="cu-item" v-if="roles.indexOf('create-report')!=-1" @click="goCreateReportList">
				<view class="cuIcon-favorfill text-yellow">
				</view>
				<text>报告编制</text>
			</view>
			<view class="cu-item" v-if="roles.indexOf('review')!=-1" @click="goReviewReportList">
				<view class="cuIcon-vipcard text-brown">
				</view>
				<text>报告复核</text>
			</view>
			<view class="cu-item" v-if="roles.indexOf('query')!=-1" @click="goPayedReportList">
				<view class="cuIcon-pay text-cyan">
				</view>
				<text>报告查看</text>
			</view>
			<view class="cu-item hide">
				<view class="cuIcon-recordfill text-orange">
				</view>
				<text>草稿箱</text>
			</view>
			<view class="cu-item hide">
				<view class="cuIcon-noticefill text-olive">
					<view class="cu-tag badge">
						<block>56</block>
					</view>
				</view>
				<text>消息通知</text>
			</view>
		</view>
		<view class="cu-list menu">
			<view class="cu-item" @click="goMineDetail">
				<view class="content">
					<text class="cuIcon-profilefill text-mauve"></text>
					<text class="text-grey">我的基本信息</text>
				</view>
			</view>
			<view class="cu-item hide">
				<view class="content">
					<text class="cuIcon-questionfill text-red"></text>
					<text class="text-grey">帮助反馈</text>
				</view>
			</view>
			<view class="cu-item hide">
				<view class="content">
					<text class="cuIcon-friendaddfill text-green"></text>
					<text class="text-grey">加入我们</text>
				</view>
			</view>
			<view class="cu-item hide">
				<view class="content">
					<text class="cuIcon-brandfill text-mauve"></text>
					<text class="text-grey">版权信息</text>
				</view>
			</view>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				member:uni.getStorageSync('member'),
				roles:uni.getStorageSync('roles'),
				rolesCommon:false,
				rolesSubmit:false,
			};
		},
		props:{
			showState: {
			  // 页面show状态
			  type: Number,
			  default: 0
			}
		},
		watch:{
			showState(){
				console.log("showState")
				this.init()
			},
			
		},
		onReady:function(e){
			console.log("===============onReady=========")
			// this.bblos.checkLoginState()
			this.init()
		},
		methods:{
			goAuth(){
				this.bblos.checkLoginState()
			},
			init(){
				this.getMemberInfo();
			},
			getMemberInfo(){
				let self=this
				let member=uni.getStorageSync("member")
				if(member.memberId){
				let data={memberId:member.memberId}
					this.bblosApi.memberApi.getMemberInfo(data).then(res=>{
						self.member=res.data.data
						if(self.member){
							uni.setStorageSync("member",res.data.data)
						}
					})				
				}
			},
			goMineDetail(){
				uni.navigateTo({
					url:"/pages/mine/detail/detail"
				})
			},
			goAcceptOrderList(){
				uni.navigateTo({
					url:"/pages/mine/acceptOrderList/acceptOrderList"
				})
			},
			goMineOrderList(){
				uni.navigateTo({
					url:"/pages/basics/orderList/orderList"
				})
			},
			goCreateReportList(){
				uni.navigateTo({
					url:"/pages/mine/createReportList/createReportList"
				})
			},
			goReviewReportList(){
				uni.navigateTo({
					url:"/pages/mine/reviewReportList/reviewReportList"
				})
			},
			goPayedReportList(){
				uni.navigateTo({
					url:"/pages/mine/payedOrder/payedOrder"
				})
			}
		}
	}
</script>

<style lang="scss">
	.mine-top{
		height: 160upx;
		display: flex;
		align-items: center;
	}
	.mine{
		width: 100%;
		color: #FFFFFF;
		display: flex;
		flex-direction: row;
		align-items: center;
		justify-content: space-between;
	}
	
</style>
